|
|
|
|
|
|
|
Line (0, 0)(100, 100)
Line -(200, 400)
Line -(300, 300)
Line -(400, 500) |
|
|
|
|
|
|
|
|
The Line method honors custom coordinates, so it places the line's end points where they belong in the current coordinate system. |
|
|
|
|
|
|
|
|
The Circle method draws circles, ellipses, and sections of circles and ellipses. It uses the syntax: |
|
|
|
|
|
|
|
|
Circle Step(x, y), radius, color, start, end, aspect |
|
|
|
|
| |
|
|
|
|
If you include the Step keyword, the X and Y coordinates of the circle's center are relative to the end of your last drawing command. |
|
|
|
| | |
|
|
|
|
The coordinates where you want the center of the circle. |
|
|
|
| | |
|
|
|
|
The radius of the circle. |
|
|
|
| | | | |
|
|
|
|
The starting and ending angles for drawing an arc or pie slice. |
|
|
|
| | |
|
|
|
|
The aspect ratio (height divided by width) for drawing ellipses. |
|
|
|
|
|
|
|
|
|
|
The angles used by the Circle method are measured counterclockwise in radians where a horizontal line to the right lies along the angle 0. Figure 1.6 shows how Visual Basic measures angles. |
|
|
|
|
|
|
|
|
You can convert from radians to degrees using the following formulas. |
|
|
|
 |
|
|
|
|
radians = degrees / 180 * 3.14159265
degrees = radians * 180 / 3.1415926 |
|
|
|
|
|
|
|
|
The Circle method has several interesting features. If you set start to a negative number, Circle draws a line from the center of the circle to the starting point and then treats start as a positive angle. Similarly, if end is negative, the Circle method draws a line from the center to the end position and treats end as a positive angle. Using these features, you can draw pie slices. The commands below draw the pie slice shown in Figure 1.7. |
|
|
|
 |
|
|
|
|
Const PI = 3.14159265
Circle (50, 50), 30, , -p / 6, -p * 0.75 |
|
|
|
|
|
|
|
|
Figure 1.6
Measuring angles in Visual Basic. |
|
|
|
|
|